//
//  WeatherViewController.m
//  UIA段项目 墨家天气
//
//  Created by dllo on 15/8/20.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "WeatherViewController.h"
//#import "WeatherCell.h"
#import "HederView.h"
#import "URL.h"
#import "AsyncURLconnection.h"
#import "AddCity.h"

#import "GDataXMLNode.h"
#import "NovelModel.h"
#import "NovelDataBase.h"
#import "MyCollectionCell.h"
#import "UIImageView+WebCache.h"
#import "WeaHeaderAddButton.h"
#import "AweakController.h"
//#import "ZSCell.h"
#import "ZSViewController.h"
#import "MJRefresh.h"
#import "AnimationsViewController.h"
#import "LiveWebVIew.h"
#import "Reachability.h"
//#import "UMSocial.h"
@interface WeatherViewController ()<AsyncURLconnectionDelegate,UICollectionViewDataSource,UICollectionViewDelegate,HederViewDelegate,MyCollectionCellDelegate>
//, UMSocialUIDelegate
@property (nonatomic, retain) NSMutableArray *arr;
@property (nonatomic, retain) UITableView *tableView;
@property (nonatomic, retain) UIScrollView *scroll;
@property (nonatomic, retain) UIView *headerView;
@property (nonatomic, retain) UIPageControl *page;
@property (nonatomic, retain) NSMutableArray *quShiArr;
@property (nonatomic, retain) WeaHeaderAddButton *headerButton;
@property (nonatomic, retain) NSMutableArray *bigbigArray;
@property (nonatomic, assign) NSInteger count;
@property (nonatomic, retain) UIActivityIndicatorView *acticity;
@property (nonatomic, retain) NSMutableArray *scoreArr;
@property (nonatomic, retain) NSMutableArray *scorebigArr;
@property (nonatomic, retain) NSURL *url;
@property (nonatomic, retain) NSMutableDictionary *qushiDic;
@property (nonatomic, retain) UIVisualEffectView *effV;
@property (nonatomic, retain) NSMutableArray *backArr;
@property (nonatomic, retain) NSMutableArray *adArr;

@property (nonatomic,retain)UIImageView *backG;
@end

@implementation WeatherViewController
-(void)dealloc
{
    
    [_arr release];
    [_tableView release];
    [_scroll release];
    [_headerView release];
    [_headerButton release];
    [_page release];
    [_acticity release];
    [_reciveArr release];
    [_bigbigArray release];
    [_quShiArr release];
//    [_aWeak release];
    [super dealloc];
    
}
-(instancetype)init
{
    self = [super init];
    if (self) {

        self.reciveArr = [NSArray array];
        self.reciveArr =  [NovelDataBase selectAll];
        self.bigbigArray = [NSMutableArray array];
        self.quShiArr= [ NSMutableArray array];
        self.scoreArr = [NSMutableArray arrayWithObjects:@"优",@"良",@"中",@"轻度", nil];
        self.qushiDic = [NSMutableDictionary dictionary];
        for (int i = 0; i < self.reciveArr.count; i++) {
            NSMutableArray *array = [NSMutableArray array];
            [self.bigbigArray addObject:array];
        }
        self.backArr = [NSMutableArray array];
        self.adArr = [NSMutableArray array];
        self.backG = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
        
        NSLog(@"我改的");
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self addCollectionView];
    [self addPageControll];
    self.navigationController.navigationBar.hidden = YES;
    self.automaticallyAdjustsScrollViewInsets = NO;
}

- (void)judgeNet
{
    if ([URL  judgeConnection]== NO) {
        
        UIView *viewNoWWW = [[UIView alloc]initWithFrame:CGRectMake(( self.view.frame.size.width - 220 * OffWidth) / 2, 150 * OffHeight, 220 * OffWidth, 30 * OffHeight)];
        viewNoWWW.layer.cornerRadius = 15;
        [self.view addSubview:viewNoWWW];
        UILabel *text = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 220 * OffWidth, 30 * OffHeight)];
        text.text = @"当前无网络，为上次刷新数据";
        text.textColor = [UIColor whiteColor];
        text.textAlignment = 1;
        text.font = [UIFont boldSystemFontOfSize:15 * OffWidth];
        [viewNoWWW addSubview:text];
        
        
        [UIView animateWithDuration:5 animations:^{
            viewNoWWW.alpha = 0.01;
            
        } completion:^(BOOL finished) {
            [viewNoWWW release];
            [viewNoWWW removeFromSuperview];
            
        }];

    }
   
    

}



#if 1
// 网络解析数据
- (void)addQushiHandle:(NSString *)cityName cityId:(NSString *)cityId indext:(NSInteger)indext
{
//  判断有没有网络
    [self judgeNet];

    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
//    view.backgroundColor = [[UIColor blackColor]colorWithAlphaComponent:0.2];
    [self.view addSubview:view];
    [view release];
    
    self.acticity = [[UIActivityIndicatorView alloc]initWithFrame:CGRectMake(0, 0, 32 * OffWidth, 32 * OffHeight)];
    self.acticity.center = view.center;
    self.acticity.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhite;
    [view addSubview:self.acticity];
    [self.acticity startAnimating];
    [_acticity release];
    
    
    
#pragma mark - 小圆圈
    

    
    // 转码
    NSString *name = [cityName  stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
    
    [dic setValue:cityId forKey:@"city"];
    [dic setValue:name forKey:@"cityName"];
    
    [dic setValue:@"210" forKey:@"act"];
    [dic setValue:@"0" forKey:@"isfamily"];
    [dic setValue:@"4" forKey:@"mt"];
    [dic setValue:@"3.11.1" forKey:@"sv"];
    [dic setValue:@"4.4.4" forKey:@"osv"];
    [dic setValue:@"868033019886185" forKey:@"imei"];
    [dic setValue:@"M040" forKey:@"dm"];
    [dic setValue:@"10" forKey:@"nt"];
    [dic setValue:@"401FFD8CECB45C1FB7D40679012FC227%7C581688910330868" forKey:@"CUID"];
    [dic setValue:@"115" forKey:@"pid"];
    [dic setValue:@"1009967d" forKey:@"chl"];
   
   
    // 获取数据
    [URL conectionWithUrl:@"http://tq.91.com/api/" dic:dic block:^(NSData *data) {
        [self.quShiArr removeAllObjects];
        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSUTF8StringEncoding error:nil];
       
        

        NSArray *myTitle = [dic objectForKey:@"items"];
        [[self.bigbigArray objectAtIndex:indext] addObjectsFromArray:myTitle];
       
        [self.acticity stopAnimating];
        [view removeFromSuperview];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            [self.collect reloadData];
        });


        
        if ([URL judgeConnection] == YES) {
        
        [self.collect reloadData];
        }
        
    }];
    
    
    
    
   }

#endif
- (void)addCollectionView
{
    
    
    UICollectionViewFlowLayout *flow = [[UICollectionViewFlowLayout alloc]init];
    [flow setMinimumLineSpacing:0];
    flow.itemSize = CGSizeMake(self.view.frame.size.width, self.view.frame.size.height);
    flow.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    
    self.collect = [[UICollectionView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height) collectionViewLayout:flow];
    _collect.delegate = self;
    _collect.dataSource = self;
    _collect.pagingEnabled = YES;
    [_collect  setBackgroundView:_backG];
    [self.view addSubview:_collect];
    //********设置当点击 城市按钮回到相应的 第一个界面

    _collect.contentOffset = CGPointMake(self.item * self.view.frame.size.width, 0);

    //注册重用池中所放置的cell 的类型
    
    [_collect registerClass:[MyCollectionCell  class] forCellWithReuseIdentifier:@"reuse"];
    [flow release];
    [_collect release];

}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    
    //判断每次跳转页面返回时  回到当前页面
     self.item = indexPath.item;
   
     MyCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"reuse" forIndexPath:indexPath];



  //    从数据库获取城市名字

     NovelModel *model = [[NovelModel alloc]init];
     model = [self.reciveArr objectAtIndex:indexPath.item] ;
     self.reciveCityId = model.cityId ;
     self.reciveCityName = model.cityName;
    
   //设置城市标题
    
   
//    
//    UIImageView *imageV = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)];
//    self.url = [NSURL URLWithString:model.backImage];
//    [imageV sd_setImageWithURL:_url];
//    [cell.tableV setBackgroundView:imageV];
//    
//    [imageV release];
//    
//
    
    
    self.quShiArr = [self.bigbigArray objectAtIndex:indexPath.item];
    if (self.quShiArr.count == 0) {
        
        
        [self addQushiHandle:model.cityName cityId:model.cityId indext:indexPath.item];
        
        
    }
    else{

       
        for ( int i = 0; i < self.quShiArr.count; i ++) {
            if ([[[[self.quShiArr objectAtIndex:i] objectForKey:@"type"] stringValue] isEqualToString:@"200" ]) {
                
                self.qushiDic = [[self.quShiArr objectAtIndex:i] objectForKey:@"future"];
                
            }
        }
        
        
        //向tableView里传一个数组  属性传值
        
        cell.QSName = self.reciveCityName;
        cell.QSArr = [self.qushiDic objectForKey:@"items"];
       //给主页面的信息赋值
        
        [self setValueWithWind:cell.viewT.wind temp:cell.viewT.tempratureLable shidu:cell.viewT.shidu sky:cell.viewT.sky date:cell.viewT.date score:cell.viewT.score du:cell.viewT.du];
        
        //给主页面上的 五个星期button赋值
        [self setValueWithWeakButton:cell.viewT.buttonYesterday temp:0];
        [self setValueWithWeakButton:cell.viewT.buttonToday temp:1];
        [self setValueWithWeakButton:cell.viewT.buttonTomday temp:2];
        [self setValueWithWeakButton:cell.viewT.buttonHouday temp:3];
        [self setValueWithWeakButton:cell.viewT.buttonDahouday temp:4];

        
        //判断 云  是什么样式的
        NSInteger j1 = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:0] objectForKey:@"climate"] objectForKey:@"id"]integerValue];
        cell.viewT.buttonYesterday.yunImage.image = [self panduanTianQi:j1];
        
        NSInteger j2 = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:1] objectForKey:@"climate"] objectForKey:@"id"]integerValue];
        cell.viewT.buttonToday.yunImage.image = [self panduanTianQi:j2];
        
        NSInteger j3 = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:2] objectForKey:@"climate"] objectForKey:@"id"]integerValue];
        cell.viewT.buttonTomday.yunImage.image = [self panduanTianQi:j3];
        
        NSInteger j4 = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:3] objectForKey:@"climate"] objectForKey:@"id"]integerValue];
        cell.viewT.buttonHouday.yunImage.image = [self panduanTianQi:j4];
        
        NSInteger j5 = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:4] objectForKey:@"climate"] objectForKey:@"id"]integerValue];
        cell.viewT.buttonDahouday.yunImage.image = [self panduanTianQi:j5];
        

        
        
        
        for (int i = 0; i < self.quShiArr.count; i ++) {
            if ([[[[self.quShiArr objectAtIndex:i] objectForKey:@"type"] stringValue] isEqualToString:@"700"]) {
                self.adArr = [[self.quShiArr objectAtIndex:i] objectForKey:@"items"];
            }
        }
        
        if (self.adArr.count >= 2) {
            
            
            NSURL *url = [NSURL URLWithString:[[self.adArr objectAtIndex:1]objectForKey:@"logo"]];
            cell.upLable.text = [[self.adArr objectAtIndex:1]objectForKey:@"text"];
            [cell.upImage sd_setImageWithURL:url];
        }
        
        if (self.adArr.count >= 3){
            
            NSURL *url2 = [NSURL URLWithString:[[self.adArr objectAtIndex:2]objectForKey:@"logo"]];
            [cell.downImage sd_setImageWithURL:url2];
            cell.downLable.text = [[self.adArr objectAtIndex:2] objectForKey:@"text"] ;
            cell.downLableTime .text = [[[self.adArr objectAtIndex:2] objectForKey:@"bottom"] objectForKey:@"right"];
            cell.downLableFrom.text = [[[self.adArr objectAtIndex:2] objectForKey:@"bottom"] objectForKey:@"left"];
        }
        cell.backgroundColor = [UIColor clearColor];
  
        [cell.tableV reloadData];
  }

    
    
//        cell.tableV.frame = CGRectMake(0, 0, cell.contentView.frame.size.width, cell.contentView.frame.size.height - 49 * OffHeight);
    
    
    
    cell.viewT.delegate = self;
    cell.xieyi = self;
 
    
#warning 下拉刷新

  [cell.tableV addHeaderWithCallback:^{
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            
            [self addQushiHandle:self.reciveCityName  cityId:self.reciveCityId  indext:self.item];
            [cell.tableV headerEndRefreshing];

        });
    }];

    

    return cell;
    
    
}

- (void)setValueWithWind:(UILabel *)wind temp:(UILabel *)temp shidu:(UILabel *)shidu sky:(UILabel *)sky date:(UILabel *)date score:(UILabel *)score du:(UILabel *)du
{
    wind.text = [[[[self.qushiDic objectForKey:@"items"] objectAtIndex:1] objectForKey:@"winds"] objectForKey:@"direction"];
    temp.text=  [[[self.qushiDic objectForKey:@"temp"] objectForKey:@"height"] stringValue];
    shidu.text =  [[[[self.qushiDic objectForKey:@"items"] objectAtIndex:1] objectForKey:@"winds"] objectForKey:@"grade"];
    sky.text = [[[[self.qushiDic objectForKey:@"items"]objectAtIndex:1]objectForKey:@"climate"]objectForKey:@"name" ];
    sky.backgroundColor =  [[UIColor grayColor] colorWithAlphaComponent:0.5];
    date.text = [[[self.qushiDic objectForKey:@"items"] objectAtIndex:1]objectForKey:@"date"];
    
    score.backgroundColor  =  [[UIColor yellowColor] colorWithAlphaComponent:0.6];
    int jj = arc4random()% 4;
    NSString *sc = [self.scoreArr objectAtIndex:jj];
    int kk = arc4random()%100 + 1;
    NSString *jk = [NSString stringWithFormat:@"%d%@",kk,sc];
    score.text = jk;
    
    du.text = @"。";
//    du.frame =  CGRectMake(160 * OffWidth, self.view.frame.size.height - 390 * OffHeight, 30 * OffWidth, 30 * OffHeight);

    
}
//赋值  封装
- (void)setValueWithWeakButton:(MyButton *)button temp:(NSInteger)temp
{
    
    if (temp == 1) {
        button.weak.text = @"今天";
        button.weak.textColor = [UIColor greenColor];
    }else{
    button.weak.text = [[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"dateName"];
    }
    button.highTemp.text = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"temp"] objectForKey:@"height"] stringValue];
    button.lowTemp.text = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"temp"] objectForKey:@"low"] stringValue];
    button.weather.text = [[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"climate"] objectForKey:@"name"];
    
    button.highDu.text = @"。";
    button.lowDu.text = @"。";
    int jj = arc4random()% 4;
    button.score.backgroundColor = [[UIColor yellowColor] colorWithAlphaComponent:0.6];
    button.score.text = [self.scoreArr objectAtIndex:jj];

    
}
- (void)gotoAnimationsWithArr:(NSMutableArray *)arr name:(NSString *)name
{
    AnimationsViewController *animation = [[AnimationsViewController alloc]init];
    animation.arr = arr;
    animation.QSName = name;
    animation.backUrl = self.url;
    
    [self.navigationController pushViewController:animation animated:YES];

}
- (void)GoTo
{
    AweakController *aweak = [[AweakController alloc]init];
    aweak.content = self.item;
    aweak.aWeakArr = [self.qushiDic objectForKey:@"items"];
    aweak.cityName = self.reciveCityName;
    aweak.backImageStr = self.url;
    [self.navigationController pushViewController:aweak animated:YES];
    [aweak release];
}
- (void)addClick:(UIButton *)button

{
    AddCity *add = [[AddCity alloc]init];
    add.backUrl = self.url;
//    add.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:add animated:YES];
    [add release];
    
}
- (void)send:(UIButton *)button
{
    ZSViewController *zs = [[ZSViewController alloc]init];
    
    if (button.tag == 1) {
        zs.zhishutype = @"cy";
    }else if (button.tag == 2) {
        zs.zhishutype = @"xc";
    }else if (button.tag == 3){
        zs.zhishutype = @"gm";
    }else if (button.tag == 4){
        zs.zhishutype = @"uv";
    }else{
        zs.zhishutype = @"yd";
    }    
    zs.cityName = self.reciveCityName;
    
    [self.navigationController pushViewController:zs animated:YES];
    
}


//首页面最底部 跳转webView
- (void)gotoWebViewWithURL:(NSInteger)index
{
    LiveWebVIew *web = [[LiveWebVIew alloc]init];
    if (index == 0) {
        
        NSString *str =  [[self.adArr objectAtIndex:1] objectForKey:@"act"];
        web.urlStr  = str;
        [self presentViewController:web animated:YES completion:nil];
        
    }else{
        NSString *str =  [[self.adArr objectAtIndex:2] objectForKey:@"act"];
        web.urlStr  = str;
        [self presentViewController:web animated:YES completion:nil];
    }
    [web release];
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    
    return self.reciveArr.count;

}



- (void)addHeaderView
{
    
    self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60 * OffHeight)];
    _headerView.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.1];
    [self.view addSubview:_headerView];
    [_headerView release];
    
   
    self.headerButton = [[WeaHeaderAddButton alloc]init];
    _headerButton.frame = CGRectMake(self.view.frame.size.width / 2 - 75 * OffWidth, 25 * OffHeight, 150 * OffWidth, 30 * OffHeight);
    _headerButton.highlighted = YES;
    [_headerButton addTarget:self action:@selector(addClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_headerButton];
    [_headerButton release];
    

    
    
    
    
    
    UIButton *enjoy = [UIButton buttonWithType:UIButtonTypeSystem];
    enjoy.frame = CGRectMake(self.headerView.frame.size.width - 30 * OffWidth, 30 * OffHeight, 20 * OffWidth, 20 * OffHeight);
    [enjoy setImage:[UIImage imageNamed:@"fanxiang.png"] forState:UIControlStateNormal];
//    [enjoy addTarget:self action:@selector(enjoy:) forControlEvents:UIControlEventTouchUpInside];
    [self.headerView addSubview:enjoy];
    
    
}
//- (void)enjoy:(UIButton *)enjoy
//{
//    [UMSocialSnsService presentSnsIconSheetView:self
//                                         appKey:@"55eae0e067e58ee28e0028e7"
//                                      shareText:@"你要分享的文字"
//                                     shareImage:[UIImage imageNamed:@"icon.png"]
//                                shareToSnsNames:[NSArray arrayWithObjects:UMShareToSina,UMShareToTencent,UMShareToRenren,nil]
//                                       delegate:self];
//    
//}

- (void)addPageControll
{
    self.page = [[UIPageControl alloc]initWithFrame:CGRectMake(self.view.frame.size.width / 2 - 60 * OffWidth, 45 * OffHeight, 120 * OffWidth, 20 * OffHeight)];
    _page.numberOfPages = self.reciveArr.count; //第二页穿过来得数组的个数  决定页数
    [_page setCurrentPage:self.item];
    [self.headerView addSubview:_page];
}

#if 1
- (void)viewWillAppear:(BOOL)animated
{
    self.reciveArr =   [NovelDataBase selectAll];
    NSInteger a = self.bigbigArray.count;
    for (NSInteger i = a; i < self.reciveArr.count; i++) {
        NSMutableArray *array = [NSMutableArray array];
        [self.bigbigArray addObject:array];
    }
    
    [self.collect removeFromSuperview];
    [self addCollectionView];
    [self addHeaderView];
    [self addPageControll];
    
    
    
   //当时图将要出现给主页面 赋初始值
    NovelModel *model = [[NovelModel alloc]init];
    model = [self.reciveArr objectAtIndex:self.collect.contentOffset.x / self.view.frame.size.width];
    self.headerButton.cityName.text = model.cityName;
    self.url = [NSURL URLWithString:model.backImage];

    [_backG sd_setImageWithURL:_url];
    


}
#endif

- (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath
{
    _page.currentPage = self.collect.contentOffset.x / self.view.frame.size.width;
    
   
        
        NovelModel *model = [[NovelModel alloc]init];
        model = [self.reciveArr objectAtIndex:self.collect.contentOffset.x / self.view.frame.size.width];
        self.headerButton.cityName.text = model.cityName;
        self.url = [NSURL URLWithString:model.backImage];
        [_backG sd_setImageWithURL:_url];
  
    
}


//封装   判断云   完美！
- (UIImage *)panduanTianQi:(NSInteger )jjj
{
    if (jjj == 1) {
        UIImage *imagee = [UIImage imageNamed:@"qing.png"];
        return imagee;
    }else if (jjj == 2){
        UIImage *imagee = [UIImage imageNamed:@"duoyun.png"];
        return imagee;
    }else if (jjj == 3){
        UIImage *imagee = [UIImage imageNamed:@"yin"];
        return imagee;
    }else if (jjj == 4){
       UIImage *imagee = [UIImage imageNamed:@"xiaoyu.png"];
        return imagee;
    }else{
       UIImage *imagee= [UIImage imageNamed:@"baoyu.png"];
        return imagee;
    }
    
}

//tableView  传偏移量到本页
//- (void)sendTableViewContentSize:(CGFloat)size
//{
//    
//    self.content = size;
//    
//    
//}
//- (void)sendTableViewContentSizeToWeather:(CGFloat)size
//{
////    self.content = size;
//
//}


- (void)setValueWithButton:(QSButton *)button temp:(NSInteger )temp
{
    
    if (temp == 1) {
        button.weak.text = @"今天";
        button.weak.textColor = [UIColor greenColor];
        button.high.textColor = [UIColor greenColor];
        button.low.textColor = [UIColor greenColor];
        button.sky.textColor = [UIColor greenColor];
        button.wind.textColor = [UIColor greenColor];
        button.highPoint.textColor = [UIColor greenColor];
        button.lowPoint.textColor = [UIColor greenColor];
    }else{
        
        button.weak.text = [[[self.qushiDic objectForKey:@"items"]  objectAtIndex:temp] objectForKey:@"dateName"];
    }
    button.sky.text = [[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"climate"] objectForKey:@"name"];
    button.wind.text = [[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"winds"] objectForKey:@"direction"];
    
    button.high.text = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"temp"] objectForKey:@"height"] stringValue];
    button.low.text = [[[[[self.qushiDic objectForKey:@"items"] objectAtIndex:temp] objectForKey:@"temp"] objectForKey:@"low"] stringValue];
    
    button.high.frame = CGRectMake(20 * OffWidth,270 * OffHeight - button.high.text.intValue * 7, 30 * OffWidth, 30 * OffHeight);
    button.low.frame = CGRectMake(20 * OffWidth, 300 * OffHeight - button.low.text.intValue * 7  , 30 * OffWidth, 30 * OffHeight);
    button.highPoint.frame = CGRectMake(38 * OffWidth,260 * OffHeight - button.high.text.intValue * 7, 30 * OffWidth, 30 * OffHeight);
    button.highPoint.text = @"。";
    button.lowPoint.frame = CGRectMake(38 * OffWidth, 290 * OffHeight - button.low.text.intValue * 7  , 30 * OffWidth, 30 * OffHeight);
    button.lowPoint.text = @"。";
    
    
}


@end
